Platform Explorer / Nuxeo Platform 2023.9

Component org.nuxeo.ecm.core.schema.TypeService

Documentation

Manage document types and schemas. Allows registrering new types defined using XSD schemas

Requirements

Resolution Order

158
The resolution order represents the order in which this component has been resolved by the Nuxeo Runtime framework.
You can influence this order by adding "require" tags in your component declaration, to make sure it is resolved after another component.

Start Order

14 (Declared Start Order: -100)
The start order represents the order in which this component has been started by the Nuxeo Runtime framework.
This number is interesting to tweak if your Java component interacts with other components, and needs to be started before or after another one.
It can be changed by implementing the method "Component#getApplicationStartedOrder()" on your Java component: components are sorted according to this reference value, in increasing order.
The default value is 1000, and the repository initialization uses number 100. Negative values can also be used.

Implementation

Class: org.nuxeo.ecm.core.schema.TypeService

Services

Extension Points

XML Source

<?xml version="1.0"?>
<component name="org.nuxeo.ecm.core.schema.TypeService" version="1.0.0">
  <documentation>
    Manage document types and schemas.
    Allows registrering new types defined using XSD schemas
    @author Bogdan Stefanescu (bs@nuxeo.com)
  </documentation>

  <require>org.nuxeo.ecm.core.schema.ObjectResolverService</require>

  <service>
    <provide interface="org.nuxeo.ecm.core.schema.SchemaManager" />
    <provide interface="org.nuxeo.ecm.core.schema.TypeProvider" />
    <provide interface="org.nuxeo.ecm.core.schema.PropertyCharacteristicHandler" />
  </service>

  <implementation class="org.nuxeo.ecm.core.schema.TypeService" />

  <extension-point name="configuration">

    <documentation>
      Type manager configuration.
      <p />
      This contains default prefetch options and clearComplexPropertyBeforeSet options. For example:
      <code>
        <configuration>
          <prefetch>common, dublincore</prefetch>
          <clearComplexPropertyBeforeSet>true</clearComplexPropertyBeforeSet>
          <allowVersionWriteForDublinCore>false</allowVersionWriteForDublinCore>
        </configuration>
      </code>
      Note that since 11.1, setting fields, such as dc:modified, as prefetch is DEPRECATED:
      only schema names are supported.

      Note that setting clearComplexPropertyBeforeSet to false is DEPRECATED since 9.3.
      Note that setting allowVersionWriteForDublinCore to true is DEPRECATED since 10.3.
    </documentation>

    <object class="org.nuxeo.ecm.core.schema.TypeConfiguration" />

  </extension-point>

  <extension-point name="doctype">

    <documentation>
      Extension Point to register new document types and facets.
      <p />
      Document types may implement several schemas and extends other
      document types. You can compare document types with java
      classes and schemas with java interfaces. Document types may
      also contains several facets that define a behavior.
      <p />
      The prefetch element defines what fields are synchronously
      indexed, and are made available in search results listings.
      <p />
      A doctype XML extension may contain several 'doctype' elements.
      A doctype element may look like this:

      <code>
        <doctype name="File" extends="Document">
          <schema name="common" />
          <schema name="file" />
          <schema name="dublincore" />
          <schema name="uid" />
          <facet name="Downloadable" />
          <facet name="Versionable" />
          <prefetch>dc:title, dc:modified, uid.uid</prefetch>
        </doctype>
      </code>

      Document types may also specify subtypes, which are sets of other
      document types that can be created inside the this document type
      being defined.
      <p />
      This configuration only applies in the UI and will not affect
      documents created through APIs (e.g. REST, Java)
      This can be achieved as follows:

      <code>
        <doctype name="SomeFolder" extends="Document">
          <subtypes>
            <type>File</type>
          </subtypes>
        </doctype>
      </code>

      When extending a doctype, forbidden subtypes can also be specified
      to prevent a specific type from being created.
      <p />
      This configuration only applies in the UI and will not affect
      documents created through APIs (e.g. REST, Java)

      <code>
        <doctype name="SomeFolder" append="true">
          <subtypes>
            <type>SomeOtherFile</type>
          </subtypes>
          <subtypes-forbidden>
            <type>File</type>
          </subtypes-forbidden>
        </doctype>
      </code>

      Facets are also defined by this extension point.
      They can have zero or more schemas:

      <code>
        <facet name="MyFacet" perDocumentQuery="false" />
        <facet name="MyFacetWithData">
          <schema name="myschema" />
          <schema name="otherschema" />
        </facet>
        <facet name="MyOldFacet" enabled="false" />
      </code>

      Queries using ecm:mixinType on facets marked with
      perDocumentQuery="false" will not match any document where
      this facet has been added using DocumentModel.addFacet() and does
      not belong to the document type (this is done for performance reasons).

      Facets with enabled=false will be ignored in all document types
      still referencing them, and will not be returned when listing available facets.

      It's also possible to associate one or more schemas to all proxies:
      <code>
        <proxies>
          <schema name="myschema" />
        </proxies>
      </code>
    </documentation>

    <object class="org.nuxeo.ecm.core.schema.DocumentTypeDescriptor" />
    <object class="org.nuxeo.ecm.core.schema.FacetDescriptor" />
    <object class="org.nuxeo.ecm.core.schema.ProxiesDescriptor" />

  </extension-point>

  <extension-point name="schema">

    <documentation>
      Extension Point to register new schemas.
      <p />
      Schemas are defined using XSD files.
      The schema extension XML may containg several 'schema' objects as
      the following ones:
      <code>
        <schema name="common" src="schema/common.xsd" />
        <schema name="dublincore" prefix="dc" src="schema/dublincore.xsd" />
      </code>
      The <i>name</i> attribute uniquely identify the schema, the <i>src</i> attribute specify
      the path to that schema (relative to the bundle root) and the <i>prefix</i> is used as
      a prefix (short name) of the schema namespace.
      The schema namespace is the targetNamespace defined inside the XSD file
      <p />
      Note that multiple schemas can share the same target namespace and prefix
      <p />
      You can also create a Nuxeo Schema from a sub part of the XSD schema.
      For that you can use the xsdRootElement attribute to indicate the complex type to use.
      <code>
        <schema name="employeeSchema" src="schema/testExtension.xsd" xsdRootElement="employee" />
      </code>
      A schema can be completely disabled with:
      <code>
        <schema name="myOldSchema" enabled="false" />
      </code>
      Schemas with enabled=false will be ignored in all document types and facets
      still referencing them, and will not be returned when listing available schemas.

      Extension Point is also used to register additional property information, called property characteristic, such as:
      <ul>
        <li>secured: only administrators can edit it</li>
        <li>deprecation: flag property as deprecated or removed</li>
      </ul>
      XML extensions may contain any number of 'property' elements of the form:
      <code>
        <property schema="dublincore" name="creator" secured="true" />
        <property schema="common" name="size" deprecation="deprecated" />
        <property schema="file" name="filename" deprecation="removed" fallback="content/name" />
      </code>

      Properties declared with secured attribute can only be edited by administrators.
      <p />
      Properties declared with deprecation attribute enable deprecation mechanism inside Nuxeo Platform.
      This generates WARN message of usage to help to remove deprecated usage.
      <p />
      A contribution is one of these types:
      <ul>
        <li>deprecated: property still exists in schema definition, but it'll be removed in next version</li>
        <li>removed: property has been removed from schema definition, relax platform behavior. This will avoid Nuxeo
          property not found exceptions for remaining use of the property
        </li>
      </ul>
      The fallback attribute is optional, its value has to be a xpath referencing an existing property in the same
      schema than deprecated/removed property.
      When presents, it is used:
      <ul>
        <li>to set the value to the fallback property</li>
        <li>to get the value from the fallback property if it exists</li>
      </ul>
      Note: for a deprecated property, setValue also set value to property and getValue get value from property if
      fallback value is null.
      <p />
      For example, the contribution below enables WARN message of usage of property <i>file:filename</i>. This will also
      get/set the value from/to <i>file:content/name</i> for deprecated usage of <i>file:filename</i> property.
      <code>
        <property schema="file" name="filename" deprecation="deprecated" fallback="content/name" />
      </code>
      As it, each usage of this property will automatically fallback on the fallback and avoid exception from platform.
      This will also allows to import document declaring the removed property.
    </documentation>

    <object class="org.nuxeo.ecm.core.schema.SchemaBindingDescriptor" />
    <object class="org.nuxeo.ecm.core.schema.PropertyDescriptor" />

  </extension-point>

  <extension-point name="deprecation">

    <documentation>
      Extension Point to register deprecated/removed properties.
      XML extensions may contain any number of 'property' elements of the form:
      <code>
        <property schema="common" name="size" deprecated="true" />
        <property schema="file" name="filename" fallback="content/name" />
      </code>
      A property contributed to this extension point enables deprecation mechanisms inside Nuxeo Platform.
      This generates WARN message of usage to help to remove deprecated usage.
      <p />
      A contribution is one of these types:
      <ul>
        <li>deprecated: property still exists in schema definition, but it'll be removed in next version</li>
        <li>removed: property has been removed from schema definition, relax platform behavior. This will avoid Nuxeo
          property not found exceptions for remaining use of the property
        </li>
      </ul>
      The fallback attribute is optional, its value has to be a xpath referencing an existing property in the same
      schema than removed/deprecated property.
      When presents, it is used:
      <ul>
        <li>to set the value to the fallback property</li>
        <li>to get the value from the fallback property if it exists</li>
      </ul>
      Note: for a deprecated property, setValue also set value to property and getValue get value from property if
      fallback value is null.
      <p />
      For example, the contribution below enables WARN message of usage of property <i>file:filename</i>. This will also
      get/set the value from/to <i>file:content/name</i> for deprecated usage of <i>file:filename</i> property.
      <code>
        <property schema="file" name="filename" fallback="content/name" />
      </code>
      As it, each usage of this property will automatically fallback on the fallback and avoid exception from platform.
      This will also allows to import document declaring the removed property.
      <p />
      @since 9.2
      @deprecated since 11.1, use schema extension point with PropertyDescriptor object
    </documentation>

    <object class="org.nuxeo.ecm.core.schema.PropertyDeprecationDescriptor" />

  </extension-point>

</component>